import request from '@/utils/request'
import type { MessageType, NotifySumsResult } from './types'

class APIMessage {
    /** 获取消息列表 */
    static getList(params: PageQuery, type: MessageType) {
        return request<any, ResponseData>({
            url: '/message/list',
            method: 'POST',
            params,
            data: { type }
        })
    }

    /** 获取通知消息数量 */
    static getNotifySums() {
        return request<any, ResponseData<NotifySumsResult>>({
            url: '/message/getNotifySums',
            method: 'POST'
        })
    }

    static getNotify() {
        return request<any, ResponseData>({
            url: '/message/getNotify',
            method: 'POST'
        })
    }


    /** 点击详情 -已读 */
    static readNotify(id: any) {
        return request<any, ResponseData>({
            url: '/readNotify',
            method: 'POST',
            data: { id }
        })
    }


    /** 删除 */
    static delMassage(data: any) {
        return request<any, ResponseData>({
            url: '/message/delMassage',
            method: 'POST',
            data
        })
    }

    static getReport(message_id: any) {
        return request<any, ResponseData>({
            url: '/message/getReport',
            method: 'POST',
            data: { message_id }
        })
    }
    static report(data: any) {
        return request<any, ResponseData>({
            url: '/message/report',
            method: 'POST',
            data
        })
    }
}

export default APIMessage
